package com.rich.web.servlet;

import java.io.IOException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rich.service.CategoryService;
import com.rich.service.impl.CategoryServiceImpl;
import com.rich.utils.BeanFactory;

/**
 * 前台分类模块
 * Servlet implementation class CategoryServlet
 */
@WebServlet("/category")
public class CategoryServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;

	CategoryService cs = (CategoryService) BeanFactory.getBean("CategoryService"); 
	public String findAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
		//设置编码
		response.setContentType("html/text;charset=utf-8");
		//调用service，查询所有分类，返回json字符串
		//从mysql获取数据
		String data = cs.findAll();
		
		//从redis获取
		
		
		//将字符串返回浏览器
		response.getWriter().println(data);
		return null;
	}
}
